package com.cq.hd.product.api;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.product.api.dto.ActiveRedPacketBillPageDto;
import com.cq.hd.product.api.dto.MyPrizeRedPacketBillPageDto;
import com.cq.hd.product.api.dto.PointsRedPacketDto;
import com.cq.hd.product.api.vo.ActiveRedPacketBillPageVo;
import com.cq.hd.product.api.vo.MyPrizeRedPacketBillPageVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "hd-o2o-product-service", contextId = "active-red-packet-bill-api")
public interface TbActiveRedPacketBillApi {

    // 红包领取列表
    @GetMapping("/product/activeRedPacketBill/pageReceive")
    Result<Page<ActiveRedPacketBillPageVo>> pageReceive(@SpringQueryMap ActiveRedPacketBillPageDto activeRedPacketBillPageDto);

    // 积分商城:我的奖品[优惠券]
    @PostMapping("/product/activeRedPacketBill/pageMyPrizeRedPacket")
    Result<Page<MyPrizeRedPacketBillPageVo>> pageMyPrizeRedPacket(@RequestBody MyPrizeRedPacketBillPageDto myPrizeRedPacketBillPageDto);

    // 根据红包id+用户id获取红包领取记录
    @GetMapping("/product/activeRedPacketBill/getByRedPacketId")
    Result<ActiveRedPacketBillPageVo> getByRedPacketId(@RequestParam("redPacketId") Long redPacketId, @RequestParam("userId") Long userId);

    // 根据红包流水id获取红包领取记录
    @GetMapping("/product/activeRedPacketBill/getById")
    Result<ActiveRedPacketBillPageVo> getById(@RequestParam("id") Long id);

    // 根据红包id批量获取红包流水数据
    @PostMapping("/product/activeRedPacketBill/listActiveRedPacketBillByRedPacketIds")
    Result<List<ActiveRedPacketBillPageVo>> listActiveRedPacketBillByRedPacketIds(@RequestBody List<Long> redPacketIds);

    // 根据商家id获取已用红包流水数据
    @GetMapping("/product/activeRedPacketBill/listUsedByBusinessId")
    Result<List<ActiveRedPacketBillPageVo>> listUsedByBusinessId(@RequestParam("userId") Long userId, @RequestParam("businessId") Long businessId);

    @PostMapping("/product/activeRedPacketBill/scanRedPacketBillJob")
    Result<Boolean> scanRedPacketBillJob();

    // 根据活动id+用户id获取红包流水数据
    @GetMapping("/product/activeRedPacketBill/getByActiveIdAndUserId")
    Result<ActiveRedPacketBillPageVo> getByActiveIdAndUserId(@RequestParam("activeId") Long activeId, @RequestParam("userId") Long userId);

    // 发放积分兑换红包
    @PostMapping("/product/activeRedPacketBill/sendPointsRedPacketBill")
    Result<Boolean> sendPointsRedPacketBill(@RequestBody PointsRedPacketDto pointsRedPacketDto);
}
